# -*- coding: utf-8 -*-
"""
Created on 03 08 下午4:55 2022 
@Author : HHQUAN
@Email : 1075960398@qq.com
两类错误曲线
"""

import mpl_toolkits.axisartist as axisartist
import matplotlib.pyplot as plt
import numpy as np
from scipy import special

fig = plt.figure()
ax = axisartist.Subplot(fig, 1,1,1)
fig.add_axes(ax)

ax.axis["right"].set_visible(False)
ax.axis["top"].set_visible(False)
ax.axis["left"].set_visible(False)
ax.axis["bottom"].set_visible(False)

ax.axis["y=0"] = ax.new_floating_axis(nth_coord=0, value=0)
ax.axis["y=0"].set_axisline_style("->", size = 2.0)

ax.axis["x=0"] = ax.new_floating_axis(nth_coord=1, value=0)
ax.axis["x=0"].set_axisline_style("->", size = 2.0)

# 高斯分布
mu1, sigma1 = 4.0, 1.5**2
x1 = np.arange(mu1-15, mu1+15, 0.1)
y1 = 1/(np.sqrt(2*np.pi*sigma1))*np.exp(-(x1-mu1)**2/(2*sigma1))

mu2, sigma2 = 0.0, 2.5**2
x2 = np.arange(mu2-15, mu2+15, 0.1)
y2 = 1/(np.sqrt(2*np.pi*sigma2))*np.exp(-(x2-mu2)**2/(2*sigma2))

max0 = np.max(np.concatenate((y1, y2), axis=-1))

ax.set_xlim((-15, 15))
ax.set_ylim((-0.2, max0+0.1))

ax.plot(x1, y1)
ax.plot(x2, y2)
ax.grid(True, linestyle='--', color='gray', linewidth=0.8)



plt.show()


